[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
VGETCHR
. Summary
vgetchr();
. Description
The vgetchr function is used to read the character (including color
information) at the current cursor position on the video screen. The
return value contains the character in the first (low) byte,a nd the
color of the character in the higher (second) byte. Each component
may be extracted using the & and / operators as shown in the exam-
ple below. Basically, if 'c' is the returned character/color value,
the character alone may be obtained by using the expression
(c & 255)
while the color value is
(c / 256)
Possible colors are numbered as follows:
Black 00
Blue 01
Green 02
Cyan 03
Red 04
Magenta 05
Brown 06
Light Grey 07
Dark Grey 08
Light Blue 09
Light Green 10
Light Cyan 11
Light Red 12
Light Magenta 13
Yellow 14
White 15
To obtain a color attribute value for a color combination, the for-
mula is
color attribute value =
foreground color value + (16 * background color value)
Therefore, a Yellow character on a Blue background would have a
color attribute value of 30 (14 + (16 * 1)).
. Return Value
An integer value as described above.
. Example
int chr;
chr = vgetchr(); // Get char/color at current cursor position
printsc("The character was ");
printc(chr & 255); // get character by masking out color byte
printsc(" with a color value of ");
printn(chr / 256); // shift color byte
See Also:
vputchr
color chart
ASCII table
vgetchrs
vgetchrsa
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson